import {
  $post,
  $put,
  $get,
  $uploadImg,
  $delete
} from '../utils/request'

// 显示店铺信息
export const FIND_SHOP_BASE_INFO = shopId =>
  $post('/store-platform/shop/findShopInfoByshopId', null, {
    shopId
  })

// 商户编辑店铺
export const UPDATE_SHOP_BASE_INFO = params =>
  $put('/store-platform/shop/updateApi', params)

// 拼团列表
export const GROUP_ORDER_LIST = (shopId, pageNo, pageSize) =>
  $post(
    `/store-platform/group/findGroupPageApi?shopId=${shopId}&pageNo=${pageNo}&pageSize=${pageSize}`
  )

// 添加店铺拼团
export const ADD_GROUP_API = params =>
  $post('/store-platform/group/addGroupApi', params)

// 编辑店铺拼团
export const UPDATE_GROUP_API = params =>
  $put('/store-platform/group/updateGroupApi', params)

// 拼团订单
export const FIND_GROUP_ORDER_PAGE_API = (params, pageNo, pageSize) =>
  $post(
    `/store-platform/group/findGroupOrderPageApi?pageNo=${pageNo}&pageSize=${pageSize}`,
    params
  )

// 查询店铺拼团详情
export const FIND_GROUP_INFO_API = (shopId, groupId) =>
  $get(
    `/store-platform/group/findGroupInfoApi?shopId=${shopId}&groupId=${groupId}`
  )

// 查询拼团订单详情
export const FIND_GROUP_ORDER_INFO = groupOrderNo =>
  $get(
    `/store-platform/group/findGroupOrderInfoApi?groupOrderNo=${groupOrderNo}`
  )

// 分页查询虚拟用户
export const FIND_CUSTOMER_VIRTUAL_PAGE = (shopId, pageNo, pageSize) =>
  $post(
    `/store-platform/customerVirtual/findCustomerVirtualPageApi?shopId=${shopId}&pageNo=${pageNo}&pageSize=${pageSize}`
  )

// 删除虚拟用户
export const DELETE_CUSTOMER_VIRTUAL = (shopId, id) =>
  $post(
    `/store-platform/customerVirtual/deleteCustomerVirtual?shopId=${shopId}&id=${id}`
  )

// 创建虚拟用户
export const ADD_CUSTOMER_VIRTUAL = params =>
  $post(`/store-platform/customerVirtual/createCustomerVirtual`, params)

// 添加虚拟拼团订单
export const ADD_VIRTUAL_ORDER = params =>
  $post(`/store-platform/group/addVirtualGroupOrderApi`, params)

// 删除店铺拼团
export const DELETE_GROUP_API = (shopId, groupId) =>
  $delete(
    `/store-platform/group/deleteGroupApi?shopId=${shopId}&groupId=${groupId}`
  )

// 查询店铺趣分享
export const GET_SHOP_SHARE = shopId =>
  $get(`/store-platform/share/findShareShopListApi?shopId=${shopId}`)

// 优惠劵查询
export const GET_TYPE_COUPON = (params, pageNo, pageSize) =>
  $post(
    `/store-platform/couponType/findCouponTypePageApi?pageNo=${pageNo}&pageSize=${pageSize}`,
    params
  )

// 添加店铺趣分享
export const ADD_SHARE_SHOP = params =>
  $post(`/store-platform/share/addShareShopApi`, params)

// 更新店铺趣分享
export const UPDATE_SHARE_SHOP = params =>
  $put(`/store-platform/share/updateShareShopApi`, params)

// 查询订单列表
export const FIND_SHOP_ORDER_PAGE = (params, pageNo, pageSize) =>
  $post(
    `/store-platform/order/findOrderPageApi?pageNo=${pageNo}&pageSize=${pageSize}`,
    params
  )
// 单条订单详情
export const FIND_ORDER_NO_INFO = orderNo =>
  $get(`/store-platform/order/findOrderInfoApi?orderNo=${orderNo}`)

// 单条订单详情中间的退款信息
export const FIND_REFUND_PAGE_API = (params, pageNo, pageSize) =>
  $post(
    `/store-platform/refund/findRefundPageApi?pageNo=${pageNo}&pageSize=${pageSize}`,
    params
  )

// 退款查询手续费
export const FIND_REFUND_RATIO = (refundId, shopId) =>
  $get(
    `/store-platform/refund/findRefundRatio?refundId=${refundId}&shopId=${shopId}`
  )

// 同意退款申请
export const AGREE_REFUND = (refundId, shopId, refundFee) =>
  $post(
    `/store-platform/refund/agreeRefund?refundId=${refundId}&shopId=${shopId}&refundFee=${refundFee}`
  )

// 拒绝退款
export const REFUSE_REFUND = (refundId, refuseContent) =>
  $post(
    `/store-platform/refund/refuseRefund?refundId=${refundId}&refuseContent=${refuseContent}`
  )

// 提交核销码
export const COMPLETE_ORDER = (shopId, orderNo, extractCode) =>
  $put(
    `/store-platform/order/completeOrder?shopId=${shopId}&orderNo=${orderNo}&extractCode=${extractCode}`
  )

// 编辑订单(物流)
export const UPDATE_ORDER_API = params =>
  $put(`/store-platform/order/updateOrderApi`, params)

// 查询商铺装修信息接口
export const FIND_SHOP_DECORATION = shopId =>
  $get(`/store-platform/shopDecoration/findShopDecoration?shopId=${shopId}`)

// 编辑商铺装修信息接口
export const UPDATE_SHOP_DECORATION_API = params =>
  $put(`/store-platform/shopDecoration/updateShopDecorationApi`, params)

// 添加商铺装修信息接口
export const ADD_SHOP_DECORATION_API = params =>
  $post(`/store-platform/shopDecoration/addShopDecorationApi`, params)

// 查询商铺座位信息列表接口
export const FIND_SHOP_SEAT_LIST_API = shopId =>
  $get(`/store-platform/shopDecoration/findShopSeatListApi?shopId=${shopId}`)

// 编辑商铺座位信息接口
export const UPDATE_SHOP_SEAT_API = params =>
  $put(`/store-platform/shopDecoration/updateShopSeatApi`, params)

// 添加商铺座位信息接口
export const ADD_SHOP_SEAT_API = params =>
  $post(`/store-platform/shopDecoration/addShopSeatApi`, params)

// 查询商铺座位信查询商品类型息列表接口
export const FIND_GOODS_TYPE_LIST_API = (shopId, parentId) =>
  $get(
    `/store-platform/goodsType/findGoodsTypeListApi?shopId=${shopId}&parentId=${parentId}`
  )

// 分页查询商户
export const FIND_CUSTOMER_PAGE_API = (params, pageNo, pageSize) =>
  $post(
    `/store-platform/customer/findCustomerPageApi?pageNo=${pageNo}&pageSize=${pageSize}`,
    params
  )

// 查询商户详情
export const FIND_CUSTOMER_INFO_API = customerId =>
  $post(`/store-platform/customer/findCustomerInfoApi?customerId=${customerId}`)

// 会员管理 - 会员详情（20200223新）
export const FIND_CUSTOMER_INFO_API_NEW = (customerId, type) =>
  $get(`/store-platform/customer/info/${customerId}/${type}`)

// 上传装修banner
export const UPLOAD_ADORN_BANNER = () =>
  $uploadImg('/store-platform/upload-image', 'picFile', {
    picType: 'NORMAL',
    catalog: 'test'
  })

// 分页查询优惠券类型
export const FIND_COUPON_TYPE_PAGE_API = (params, pageNo, pageSize) =>
  $post(
    `/store-platform/couponType/findCouponTypePageApi?pageNo=${pageNo}&pageSize=${pageSize}`,
    params
  )

// 添加优惠券类型
export const CREATE_COUPON_TYPE_API = params =>
  $post(`/store-platform/couponType/createCouponTypeApi`, params)

// 删除优惠券类型
export const DELETE_COUPON_TYPE_API = (couponTypeId, shopId) =>
  $delete(
    `/store-platform/couponType/deleteCouponTypeApi?couponTypeId=${couponTypeId}&shopId=${shopId}`
  )

// 编辑优惠券类型
export const UPDATE_COUPON_TYPE_API = params =>
  $put('/store-platform/couponType/updateCouponTypeApi', params)

// 分页查询店铺营销工具接口
export const FIND_BY_SHOPID_PAGEAPI = (shopId, pageNo, pageSize) =>
  $post(
    `/store-platform/marketing/findByShopIdPageApi?shopId=${shopId}&pageNo=${pageNo}&pageSize=${pageSize}`
  )

// 分页查询服务商营销工具接口
export const FIND_BY_PROVIDERID_PAGEAPI = (providerId, pageNo, pageSize) =>
  $post(
    `/store-platform/marketing/findByProviderIdPageApi?providerId=${providerId}&pageNo=${pageNo}&pageSize=${pageSize}`
  )

// 创建营销工具支付订单
export const CREATE_MARKETING_PAY_ORDER = params =>
  $post('/store-platform/pay/createMarketingPayOrder', params)

// 删除商铺座位信息接口
export const DELETE_SHOP_SEAT_API = (seatId, shopId) =>
  $delete(
    `/store-platform/shopDecoration/deleteShopSeatApi?seatId=${seatId}&shopId=${shopId}`
  )

// 微信小程序获取openId
export const FIND_USER_OPEN_ID = (appId, appSecret, code) =>
  $get(
    `/store-api/weChatInfo/getOpenIdByMiniProgram?appId=${appId}&appSecret=${appSecret}&code=${code}`
  )

// 统计店铺评分和物流评分
export const SHOP_FIND_LOGISTICS = orderNo =>
  $get('/store-api/logistics/logisticsQuery', {
    orderNo
  })
